#ifndef __DSTH_SOCKET_H__
#define __DSTH_SOCKET_H__

#include "TcpSocketOps.h"
#include "InetSocketAddress.h"

namespace dsth {

class Socket {
public:
    Socket();
    explicit Socket(int fd) : socket_fd_(fd) {}
    virtual ~Socket();
    int Bind(const InetSocketAddress& addr);
    int Listen();
    int Accept(InetSocketAddress& addr);
    int Connect(InetSocketAddress& addr);
    int GetFd() { return socket_fd_; }
    void SetReuseAddr(bool enable);
    void ShutDownWrite();
    void Close();
private:
    // Can't invoke copy constructor or assignment operator
    Socket(const Socket&);
    void operator=(const Socket&);

    int socket_fd_;
};

} // namespace
#endif // __DSTH_SOCKET_H__
